﻿#ifndef MAPER_MEMSDATA_H
#define MAPER_MEMSDATA_H

#include <qobject.h>
#include "ObjAutoInject.h"
#include <qvector.h>
#include <qsqlquery.h>
#include <qsqlerror.h>

#include "MEMSData.h"

class DataBaseConnector;
class Mapper_MEMSData : public QObject, public ObjAutoInject
{
  Q_OBJECT
private://property
  const QString string_dataBaseName="sensorData";
  const QString string_sourceData="sensorData_sourceData";
  const QString string_createTime="sensorData_createTime";
private://dependency
  DataBaseConnector* dataBaseConnector=Q_NULLPTR;
public:
  explicit Mapper_MEMSData();
  virtual ~Mapper_MEMSData();
signals:
public:
  bool saveMEMSData(MEMSData mEMSData);
  QVector<MEMSData> getAllMEMSData();
  QVector<MEMSData> getMEMSDataByTime(QDateTime begin,QDateTime end);
private:
  QVector<MEMSData>* getList(QSqlQuery* query,QVector<MEMSData>* list);
public://geter and seter
  DataBaseConnector* getDataBaseConnector();
  void setDataBaseConnector(DataBaseConnector* dataBaseConnector);
public:
  virtual void objectAutoInjection(QHash<QString, QObject *> *objMap);
};

#endif // MAPER_MEMSDATA_H
